{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 曲面有限元"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 模型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let $S$ be a two-dimensional, compact, and closed $C^3$-hypersurface \n",
    "in $\\mathbb{R}^{3}$,  and $\\partial S=\\varnothing$. Let $f$ be a given data satisfying \n",
    "$\\int_{S}f\\,\\mathrm{d}\\sigma=0$, where $\\mathrm{d}\\sigma$ is the surface measure, \n",
    "and let $u$ be the solution of the Laplace--Beltrami equation\n",
    "\\begin{equation}\\label{BLM1}\n",
    "-\\Delta_{S}u=f \\; \\mathrm{on}\\,\n",
    "S,\n",
    "\\end{equation} where $\\Delta_{S}$ is the Laplace--Beltrami operator on the \n",
    "surface $S$. We require $\\int_{S}u\\,\\mathrm{d}\\sigma=0$ in order to \n",
    "guarantee the uniqueness of the solution to (\\ref{BLM1})."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Since $S$ is a closed surface and $\\partial S = \\varnothing$, \n",
    "it partitions the space $\\mathbb{R}^{3}$ into three distinct \n",
    "sets: points inside the surface, points on the surface, and \n",
    "points outside the surface; denoted by $\\Omega_{-}$, $\\Omega_{0}$, \n",
    "and $\\Omega_{+}$, respectively. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For any $x\\in\\mathbb{R}^{3}$, let\n",
    "$\\mathrm{dist}(x,S)=\\min_{y\\in S}|x-y|$ be the distance between $x$\n",
    "and $S$, where $|\\cdot|$ is the standard Euclidean distance. We can\n",
    "define a strip domain $U:=\\{x\\in\\mathbb{R}^{3}\\,|\\,\n",
    "\\mathrm{dist}(x,S)<\\delta\\}$, where $\\delta>0$ and is small enough \n",
    "such that we can define a unique signed distance function \n",
    "\n",
    "$$d:U\\rightarrow \\mathbb{R},$$\n",
    "satisfying the following properties: \n",
    "\n",
    "1. $d\\in C^3(U)$; $d(x)<0$ for all\n",
    "$x\\in\\Omega_{-}\\cap U$; \n",
    "1. $d(x)=0$ for all $x\\in\\Omega_{0}\\cap U=S$;\n",
    "1. $d(x)>0$ for all $x\\in\\Omega_{+}\\cap U$;\n",
    "1. $|d(x)|=\\mathrm{dist}(x,S)$  for all $x\\in U$.\n",
    "\n",
    "\n",
    "We shall view the surface $S$ as the zero level \n",
    "set of the distance function."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let $\\nabla$ be the conventional gradient operator\n",
    "in $\\mathbb{R}^{3}$. So\n",
    "\n",
    "$$\\nabla d(x)\\in\\mathbb{R}^{3}$$ \n",
    "is the gradient of $d(x)$ and \n",
    "\n",
    "$$\\boldsymbol{H}(x) := \\nabla^{2}d(x)\\in\\mathbb{R}^{3\\times3}$$\n",
    "is the Hessian matrix of $d(x)$. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For any $x\\in U$, let $y$ be the closest point of $x$ \n",
    "on $S$, i.e., $|d(x)|= |x-y|$. Since $d(x)$ is the signed\n",
    "distance function and $S$ is its zero level set, it is easy to show\n",
    "that $\\nabla d(x)$ is the unit outward normal vector of $S$ at $y$,\n",
    "namely, $|\\nabla d(x)|=1$. \n",
    "\n",
    "Then for any $x\\in U$, let \n",
    "$\\boldsymbol{n}(x)=\\nabla d(x)$.  We can define the following \n",
    "unique projection $\\mathcal P_0: U \\to S$:\n",
    "\\begin{equation}\\label{eq:PRO}\n",
    "\\mathcal{P}_{0}(x):=x-d(x)\\boldsymbol{n}(x).\n",
    "\\end{equation}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For $x\\in U$, differentiation on the identity $\\nabla \n",
    "d(x)\\cdot\\nabla d(x)=1$ implies that\n",
    "\n",
    "$$ \n",
    "\\boldsymbol{H}(x)\\nabla d(x)=\\boldsymbol{H}(x)\\boldsymbol{n}(x)=\\boldsymbol{0}.\n",
    "$$\n",
    "\n",
    "Therefore zero is an eigenvalue of $\\boldsymbol{H}(x)$ \n",
    "and $\\boldsymbol{n}(x)$ is the corresponding\n",
    "eigenvector. The other two eigenvalues of $\\boldsymbol{H}(x)$ are\n",
    "denoted by $\\kappa_{1}(x)$ and $\\kappa_{2}(x)$. When $x\\in S$,\n",
    "$\\kappa_{1}(x)$ and $\\kappa_{2}(x)$ are the principal curvatures of\n",
    "$S$ at $x$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For $v\\in C^{1}(S),$ since $S$ is $C^3$, we can\n",
    "extent $v$ to $C^{1}(U)$ and still denote the extension by\n",
    "$v$. The tangential gradient of $v$ on $S$ can\n",
    "be written as\n",
    "\n",
    "$$\n",
    "\\nabla_{S}v=\\nabla v-(\\nabla\n",
    "v\\cdot\\boldsymbol{n})\\boldsymbol{n}=(\\boldsymbol{I}\n",
    "-\\boldsymbol{n}\\boldsymbol{n}^{t})\\nabla\n",
    "v=\\boldsymbol{P}\\nabla v\\in\\mathbb{R}^{3},\n",
    "$$\n",
    "\n",
    "where $\\boldsymbol{P}(x)=(\\boldsymbol{I}-\\boldsymbol{n}\n",
    "\\boldsymbol{n}^{t})(x)$ is the projection operator to the tangent \n",
    "plane at a point $x\\in S$, and therefore $\\boldsymbol P^2 = \n",
    "\\boldsymbol P$. Notice that we use the extension of $v$ to define \n",
    "the surface gradient. However, it can be shown that $\\nabla_{S}v$ \n",
    "depends only on the value of $v$ on $S$ but not on the \n",
    "extension. Namely, $\\nabla_{S}$ is an intrinsic operator."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Similarly, for a vector field $\\boldsymbol{v}\\in(C^{1}(S))^{3}$, \n",
    "we can extend it to $(C^1(U))^3$ and define\n",
    "the tangential divergence of $\\boldsymbol{v}$ on $S$ as\n",
    "\n",
    "$$\n",
    "\\nabla_{S}\\cdot\\boldsymbol{v}=\\nabla\\cdot\\boldsymbol{v}\n",
    "-\\boldsymbol{n}^{t}\\nabla\\boldsymbol{v}\\boldsymbol{n}\\in\\mathbb{R}.\n",
    "$$\n",
    "\n",
    "The Laplace--Beltrami operator on $S$ reads as follows:\n",
    "\n",
    "$$\n",
    "\\Delta_{S}v=\\nabla_{S}\\cdot(\\nabla_{S}v)=\\Delta v-(\\nabla\n",
    "v\\cdot\\boldsymbol{n})(\\nabla\\cdot\\boldsymbol{n})-\n",
    "\\boldsymbol{n}^{t}\\nabla^{2}v\\boldsymbol{n}\\in\\mathbb{R},\n",
    "$$\n",
    "\n",
    "provided $v\\in C^{2}(S)$ and $\\nabla^{2}v$ is the Hessian matrix of\n",
    "$v$ (suitably extended as a $C^{2}(U)$ function)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 弱形式"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The variational formulation of the Laplace--Beltrami equation \n",
    "(\\ref{BLM1}) is as follows: find $u\\in H^1(S)$ such that\n",
    "\n",
    "\\begin{equation}\\label{eq:WEAK}\n",
    "\\int_{S}\\nabla_{S}u\\cdot\\nabla_{S}v\\mathrm{\\,\n",
    "d}\\sigma=\\int_{S}fv\\mathrm{\\, d}\\sigma \\quad \\text{\n",
    "for all }\\,v\\in H^{1}(S).\n",
    "\\end{equation}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 线性有限元"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For a triangle $\\tau_h\\in\\mathcal{T}_h$, let $\\{\\lambda_i\\}$ be \n",
    "the barycentric coordinates of $\\tau_h$. Let $\\mathcal V_h$ be \n",
    "the continuous piecewise linear finite element space\n",
    "on $S_{h}$, namely, for any $v_h\\in \\mathcal V_h$ and $\\tau_h \\in \\mathcal T_h$, \n",
    "$v_h$ is continuous on $S_h$ and $v_h|_{\\tau_h}\\in \n",
    "{\\rm span}\\{\\lambda_1,\\lambda_2,\\lambda_3\\}$.\n",
    "We define the corresponding lifted spaces on $S$:\n",
    "\n",
    "\\begin{eqnarray*}\n",
    " \\tilde{V}_{h} & = &\n",
    "\\{\\tilde{v}_{h} \\, | \\, \\tilde{v}_{h}:=v_{h}\\circ\\mathcal{P}_{0}^{-1},\\,\n",
    "\\text{where }v_{h}\\in \\mathcal V_h\\}.\n",
    "\\end{eqnarray*}\n",
    "\n",
    "Recall that the bijection $\\mathcal P_0: S_h \\to S$ is \n",
    "defined in (\\ref{eq:PRO}). \n",
    "For $f\\in L^{2}(S)$, let\n",
    "\\begin{equation}\\label{eq:fh}\n",
    "f_{h}(x)=\\bar{f}(x)-\\frac{1}{|S_{h}|}\\int_{S_{h}} \\bar f \\, \\mathrm{d}\\sigma_{h},\n",
    "\\end{equation}\n",
    "where $|S_{h}|$ is the area of $S_{h}$. Then\n",
    "$\\int_{S_{h}}f_{h}(x)\\,\\mathrm{d}\\sigma_{h}=0$, and therefore there exists a\n",
    "unique finite element solution $u_{h}\\in \\mathcal V_h$ with\n",
    "$\\int_{S_{h}}u_{h}\\,\\mathrm{d}\\sigma_{h}=0$ to the following\n",
    "equation:\n",
    "\\begin{equation}\\label{eq:FEM}\n",
    "\\int_{S_{h}}\\nabla_{S_{h}}u_{h}\\cdot\\nabla_{S_{h}}v_{h}\\,\\mathrm{d}\\sigma_{h}=\n",
    "\\int_{S_{h}}f_{h}v_{h}\\,\\mathrm{d}\\sigma_{h}\\quad\\text{for all }\\,v_{h}\\in\n",
    "\\mathcal V_h.\n",
    "\\end{equation}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  },
  "latex_envs": {
   "LaTeX_envs_menu_present": true,
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 0
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
